//
//  HomeThirdView.swift
//  VastSwift
//
//  Created by BestVast on 2021/5/28.
//

import UIKit

/// 第三行列表，包括 轿车类型 单项 用品 大车 微车车型 皮卡车型 工程车 全部
class HomeThirdView: UIView {

    func uiConfig() -> Void {
        self.backgroundColor = .white
        self.layer.cornerRadius = 10
        self.layer.masksToBounds = true
        
        let searchView = UIView.init(frame: CGRect.init(x: 30, y: 25, width: screenWidth - 80, height: 34))
        searchView.backgroundColor = UIColor(red: 239/255, green: 239/255, blue: 239/255, alpha: 1)
        searchView.layer.cornerRadius = 17
        searchView.layer.masksToBounds = true
        self.addSubview(searchView)
        let imageView = UIImageView.init(frame: CGRect.init(x: 15, y: 5, width: 25, height: 25))
        imageView.backgroundColor = .cyan
        searchView.addSubview(imageView)
        let titleLabel = UILabel.init(frame: CGRect.init(x: 55, y: 8, width: searchView.width - 65, height: 16))
        titleLabel.text = "请输入品牌/车型/配件等关键词"
        titleLabel.font = .systemFont(ofSize: 14)
        titleLabel.textColor = UIColor(red: 155/255, green: 155/255, blue: 155/255, alpha: 1)
        searchView.addSubview(titleLabel)
        
        let width = (screenWidth - 20) / 4
        let texts = ["轿车类型", "单项", "用品", "大车", "微车车型", "皮卡车型", "工程车", "全部"]
        for index in 0..<texts.count {
            let view = HomeSmallView.init(frame: CGRect.init(x: Int(width) * (index % 4), y: 80 + (index / 4) * (90 + 20), width: Int(width), height: 90))
            view.showViewInfo(text: texts[index], textColor: .gray, numHide: true, num: 0) {
                
            }
            self.addSubview(view)
        }
    }
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        self.uiConfig()
    }
    required init?(coder: NSCoder) {
        super.init(coder: coder)
    }
}
